<?php
/**
* エラーチェッククラス
**/
require_once( '../system/Class_M_DAO.php' );
class Class_M_AREA_AD_SHOP extends Class_M_DAO {
	//protected properties begin
	/**
	 *
	 * テーブル名
	 *
	 * @access    protected
	 * @var       string
	 *
	 */
	protected $_table = "M_AREA_AD_SHOP";
	
	/**
	 *
	 * 主キー名
	 *
	 * @access    protected
	 * @var       string
	 *
	 */
	protected $_pkey = "id";
	
	/**
	 *
	 * ソート順
	 *
	 * @access    protected
	 * @var       string
	 *
	 */
	 protected $_order = "area_ad_shop_id, shop_cd";
	 
	 protected $_cols     = array(
		"area_ad_shop_id" => array(AOKI_VARTYPE_STR),
		"shop_cd"         => array(AOKI_VARTYPE_STR),
		"shop_name"       => array(AOKI_VARTYPE_STR),
		"shop_per"        => array(AOKI_VARTYPE_STR),
		"shop_nums"       => array(AOKI_VARTYPE_STR)
	 );
	
	 protected $_checks  = array(
		"shop_cd"       => array( "EXIST" ),
		"shop_name"     => array( "EXIST" ),
		"shop_per"      => array( "EXIST", "NUM" ),
		"shop_nums"     => array( "EXIST", "NUM" ),
	 );
	 
	 //maxlength 
	 protected $_maxlens  = array( );
	 public function deleteShop( $matrixcd ) {
		$sql = "delete   sp from  M_AREA_AD_SHOP sp ,M_AREA_AD ad where sp.area_ad_shop_id = ad.id and ad.matrix_cd = '{$matrixcd}'" ;
		return $this->exec_sql($sql) ;
	}
	 public function getAreaadByWeek( $matrixcd ) {
		$sql = " SELECT * FROM M_AREA_AD WHERE matrix_cd = '{$matrixcd}' ";
		$this->_db->query( $sql );
		if( $this->_db->num_rows() ){
			$data = array();
			while( $row = $this->_db->fetch() ){
				$data[$row["area_cd"]] = $row["id"];
			}
			return $data;
		}else{
			return  FALSE;
		}
	}
}

?>

